package com.trkj.service;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.trkj.dao.jpa.IjlJlCheckResultDAO;
import com.trkj.pojos.JlCheckResult;

@Service
@Transactional
public class JlCheckResulService {
	@Autowired  
	private IjlJlCheckResultDAO CheckResultDAO;
/*
 * 查看病例信息
 */
		public Map<String, Object> queryreginByPage(int page, int rows){
			PageRequest pr = new PageRequest(page - 1, rows);
			//获取当前页的记录
			List<JlCheckResult> list = CheckResultDAO.findCheckResultByPage(pr);	
			//获取总的记录条数
			long total = CheckResultDAO.count();
			Map<String, Object> map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		//根据eid查找
		public List<JlCheckResult> findBycrId(BigDecimal sex){
			List<JlCheckResult> list=CheckResultDAO.findBycrId(sex);
			return list;
		}
		//添加检查结果
		public void addJlCheckResult(JlCheckResult s){
			CheckResultDAO.save(s);
		}
		
}
